package com.srwl.mytx.activity;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;

import com.srwl.mytx.Constant;
import com.srwl.mytx.domain.Coupon;
import com.srwl.mytx.fragment.SingleCouponDetailFragment;
import com.srwl.mytx.widget.RPTitleBar;
import com.srwl.mytx.R;


public class SingleCouponDetailActivity extends BaseActivity {

    public static void startActivity(Context context, Coupon coupon) {
        context.startActivity(new Intent(context, SingleCouponDetailActivity.class).putExtra(Constant.EXTRA_INFO_COUPON, coupon));
    }

    public static void startActivity(Context context, String couponId,boolean isSender) {
        context.startActivity(new Intent(context, SingleCouponDetailActivity.class).putExtra("couponId", couponId).putExtra("isSender",isSender));
    }

    @Override
    protected void onCreate(Bundle arg0) {
        super.onCreate(arg0);
        setContentView(R.layout.rp_activity_red_packet_detail);
        initViewsAndEvents();
    }

    protected void initViewsAndEvents() {
        RPTitleBar titleBar = findViewById(R.id.title_bar);
        titleBar.setSubTitleVisibility(View.GONE);

        titleBar.setLeftLayoutClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
        getSupportFragmentManager().beginTransaction().add(R.id.detail_fragment_container, SingleCouponDetailFragment.newInstance(getIntent())).commitAllowingStateLoss();

    }

    //必须重新，不然状态栏字体是黑色，，
    protected void setStatusDark() {
        Window window = getWindow();
        window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
        window.setStatusBarColor(getResources().getColor(R.color.rp_top_red_color));
    }


}
